package com.suep.courseScheduling.service;

import com.suep.courseScheduling.mapper.CourseSchedulingMapper;
import com.suep.courseScheduling.model.CourseScheduling;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseSchedulingService {

    @Autowired
    private CourseSchedulingMapper courseSchedulingMapper;

    public List<CourseScheduling> findAll() {
        return courseSchedulingMapper.selectList(null);
    }

    public int addCourseScheduling(CourseScheduling courseScheduling){
        return courseSchedulingMapper.insert(courseScheduling);
    }


    public boolean deleteCourseScheduling(CourseScheduling courseScheduling) {
        try {
            int result = courseSchedulingMapper.deleteById(courseScheduling);
            return result > 0;
        } catch (Exception e) {
            // 日志记录异常
            return false;
        }
    }
}